###
# Author : pepper (Shane Culpepper)
# Date   : Thu 11 Mar 2010
#
# A general makefile that will automatically make any project where all of the
# source and header files are in one directory.
#
# If there are extra source or header files in the directory that are not part
# of the project they should be moved or renamed, or else the SRC and HDR
# variables should be set manually otherwise compilation may fail.
#
# For more information about makefiles, check here:
#     http://www.gnu.org/software/make/manual/make.html
###

# The name of the applications we're trying to generate
TARGET = byte_coder 

SRC = value.c libutil.c llist.c coder.c hash_table.c byte_coder.c libtimer.c
HDR = value.h libutil.h llist.h coder.h hash_table.h libtimer.c

# The following three lines can be used to automatically generate the SRC, HDR
# and OBJ variables instead of doing it statically as above
OBJ := $(SRC:.c=.o)

# These variables are used by make in all of it's automatic rules.
# Specifically, use CFLAGS for the "-g -O0" option if you want to do debugging,
# and LDFLAGS for the "-lm" option if you are using the math library.
CC = gcc
#CFLAGS = -W -Wall -ansi -O3
CFLAGS = -W -Wall -ansi -D_XOPEN_SOURCE=500 -g

LDFLAGS = -lm

all : $(TARGET)

$(TARGET) : $(OBJ)
	$(CC) $(LDFLAGS) -o $@ $(OBJ)

# This generates the dependencies between your various .c and .h files, using
# the c compiler's -MM option.
depend : $(SRC) $(HDR)
	$(CC) $(CFLAGS) -MM $(SRC) > depend

# This includes the dependencies made with the previous rule, and in fact forces
# them to be generated.
-include depend

# The rules below clean up any files generated by the make process.  clean
# should be run to clear out the temporary files, and clobber should be run if
# you modify your makefile (for example to change the CFLAGS or LDFLAGS options)
# so that you can get a clean recompile.
.PHONY : test clean

test :
	echo "TBD"

clean :
	-rm -f depend
	-rm -f $(TARGET) $(OBJ)
	-rm -f *~ 
